<#include "../Common/basepage.ftl">
<@addCSS [
"/app/lib/css/plugins/clockpicker/clockpicker",
"/app/lib/css/plugins/select2/select2.min",
"/app/lib/css/plugins/datapicker/datepicker3",
"/app/lib/css/plugins/datapicker/bootstrap-datetimepicker",
"/app/lib/css/plugins/datapicker/bootstrap-datetimepicker.min",
"/app/lib/css/plugins/summernote/summernote-bs3",
"/app/lib/css/plugins/summernote/summernote",
"/app/lib/css/plugins/chosen/chosen",
"/app/lib/css/plugins/dataTables/datatables.min",
"/app/lib/css/plugins/footable/footable.core"
]/>

<@addJS [
"/app/lib/js/plugins/select2/select2.full.min",
"/app/lib/js/plugins/summernote/summernote.min",
"/app/lib/js/plugins/datapicker/bootstrap-datetimepicker",
"/app/lib/js/plugins/chosen/chosen.jquery",
"/app/lib/js/plugins/dataTables/datatables.min",
"/app/lib/js/plugins/footable/footable.all.min"

]/>


<@common "IT工作表">
<style>
.footable-row-detail-name{
	width:80px;
}
</style>
<input type="hidden" id="group" value="workprogress"/>
<input type="hidden" id="item" value="workingtablelist"/>
<div class="row">
    <div class="col-lg-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>IT工作表</h5>

                <div class="ibox-tools">
                    
                </div>
            </div>
            <div class="ibox-content">
            	

                <table class="table table-striped table-bordered table-hover dataTables-example" id="tb1">
                    <thead>
                    <tr>
                        
                        <th>工作分类</th>
                        <th>是否督办事项？</th>
                        <th>事项</th>
                        <th>状态</th>
                        <th>录入人</th>
                        <th>操作</th>
					</tr>
                    
                    <div class="custom_btn" style="float:left">
	            		<button type="button"  class="btn btn-primary  btn-warning" onclick="createform()" style="margin:0px 10px">新建</button>
                    </div>
                    </thead>
                    <tbody>
                    <#list datalist as data>
			            <tr class="gradeX">
			            	<td onclick="showform('${(data.id)!}')"><a href="javascript:void(0)" >${(data.jobType)!}</a></td>
			            	
			                <td >${(data.doesSupervise)!}</td>
			                <td >${(data.jobName)!}</td>
			                <td >${(data.status)!}</td>
			                <td>${(data.remark)!}</td>
					        
					<td><a href="javascript:void(0)" onclick="showform('${(data.id)!}')">编辑</a> <a href="javascript:void(0)" onclick="deleteitem('${(data.id)!}')">删除</a>
					    
			            </tr>
		            </#list>
                    </tbody>
                    <tfoot>
                    	
                    	
                        <th>工作分类</th>
                        <th>是否督办事项？</th>
                        <th>事项</th>
                        <th>状态</th>
                        <th>录入人</th>
                        <th>操作</th>
                    </tr>
                    </tfoot>
                </table>				
                <div class="footer">
		        </div> 
            </div>
        </div>
    </div>
<script>

    $(document).ready(function(){
  
    	$('#data_1 .input-group.date.form_datetime').datetimepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            format: 'yyyy-mm-dd hh:ii:ss',
            minuteStep: 1,
            autoclose: true,
            endDate : new Date()  
        });
        
		$("#liableOrgan").trigger("chosen:updated");
		$("#liableOrgan").chosen({});
		
		$("#eventType").trigger("chosen:updated");
		$("#eventType").chosen({});
		
		$('.dataTables-example').DataTable({
            dom: '<"html5buttons"B>lTfgitp',
            pageLength:25,
            "ordering": false,
            buttons: [
                { extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: 'ExampleFile'},
                {extend: 'pdf', title: 'ExampleFile'},

                {extend: 'print',
                 customize: function (win){
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');

                        $(win.document.body).find('table')
                                .addClass('compact')
                                .css('font-size', 'inherit');
                }
                }
            ]
        });
        
        $(".dataTables_length").hide();
        $(".dataTables_filter").hide();
        $(".dataTables_info").hide();
        
    });
    
    function showform(id){
    	window.location.href="${servePath}/pc/workingtable/showform/" + id;
    }
    
    function searchview(){
    	var eventType= $("#eventType_chosen .chosen-single").text();
    	eventType = eventType.substring(0,eventType.indexOf("("));
    	
    	var liableOrgan= $("#liableOrgan_chosen .chosen-single").text();
    	liableOrgan = liableOrgan.substring(0,liableOrgan.indexOf("("));
    	var data={
        		"title":$("#title").val(),
        		"eventType":$("#eventType").val(),
        		"startDateStr":$("#startDateStr").val(),
        		"endDateStr":$("#endDateStr").val(),
        		"flightNo":$("#flightNo").val(),
        		"statusDel":$("statusDel").val(),
        	};
    	
    	
    	$.ajax(
			{
				url : webCfg.servePath + "/pc/eventreportinfo/listfilter",
				type : "POST",
				async:false,
				contentType : "application/x-www-form-urlencoded; charset=UTF-8",
				data : data
			}).done(
			function(data) {
				if ($('.dataTables-example').hasClass('dataTable')) {
                    dttable = $('.dataTables-example').dataTable();
                    dttable.fnClearTable(); //清空一下table
                    dttable.fnDestroy(); //还原初始化了的datatable
                }
                $(".dataTables-example").find("tbody").html(data);
                $('.dataTables-example').DataTable({
            dom: '<"html5buttons"B>lTfgitp',
            pageLength:25,
            "ordering": false,
            buttons: [
                { extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: 'ExampleFile'},
                {extend: 'pdf', title: 'ExampleFile'},

                {extend: 'print',
                 customize: function (win){
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');

                        $(win.document.body).find('table')
                                .addClass('compact')
                                .css('font-size', 'inherit');
                }
                }
            ]
        });
        
        $(".dataTables_length").hide();
        $(".dataTables_filter").hide();
        $(".dataTables_info").hide();
				
			}).fail(function(jqXHR, error) {
				alert("error！");
		});
    }
    
    function viewreload(){
    	window.location.reload();
    }
    
    function createform(){
    	window.location.href="${servePath}/pc/workingtable/add/";
    }
	
   
    function deleteitem(id){
	var msg = "您确定要删除吗？\n\n请确认！";
	if (confirm(msg)==true){
		$.ajax({
			url: webCfg.servePath + "/pc/workingtable/delete/"+id,
			type : "POST",
			async:false,
			contentType : "application/x-www-form-urlencoded; charset=UTF-8"
		}).done(function(data) {
			    alert(data.msg);
			    window.location.reload();
		}).fail(function(jqXHR, error) {
				alert("删除失败，请联系管理员！");
		});
	}else{
	return false;
	}
    }    
    
    
    
    status('tb1');


</script>
</@common>